<extend name="Public/base" />


<block name="content">
<div id="content">
  <div id="content-header">
    <div id="breadcrumb"> <a href="{:U('Index/index')}" title="首页"
				class="tip-bottom"><i class="icon-home"></i> 首页</a> <a href="{:U('Database/index/type/import')}"
				class="current">{$meta_title}</a> </div>
  </div>
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
        <div class="widget-box">
          <div class="widget-content ">
          
            <table class="table table-bordered table-striped">
              <thead>
                <tr>
                  	<th>备份名称</th>
                    <th>卷数</th>
                    <th>压缩</th>
                    <th>数据大小</th>
                    <th>备份时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
              </thead>
              <tbody>
              	<notempty name="list">
              		<volist name="list" id="data">
                	<tr>
						<td class="taskStatus">{$data.time|date='Ymd-His',###}</td>
                        <td class="taskStatus">{$data.part}</td>
                        <td class="taskStatus">{$data.compress}</td>
                        <td class="taskStatus">{$data.size|format_bytes}</td>
                        <td class="taskStatus">{$key}</td>
                        <td class="taskStatus"><neq name="data['download']" value=""><a href="{:U('download?time='.$data['time'])}">[ 下载 ]</a></neq></td>
                        <td class="taskStatus"><a class="ajax-get confirm" href="{:U('del?time='.$data['time'])}"><i class="icon-remove"></i> 删除</a>
                        </td>
                 	</tr>
				  	</volist>
			  	<else/>
					<tr>
						<td colspan="7" class="taskStatus"> Oh~亲爱滴,暂时还没有内容! </td>
					</tr>
				</notempty>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(".db-import").click(function(){
    var self = this, status = ".";
    $.get(self.href, success, "json");
    window.onbeforeunload = function(){ return "正在还原数据库，请不要关闭！" }
    return false;

    function success(data){
        if(data.status){
            if(data.gz){
                data.info += status;
                if(status.length === 5){
                    status = ".";
                } else {
                    status += ".";
                }
            }
            $(self).parent().prev().html(data.info);
            if(data.part){
                $.get(self.href, 
                    {"part" : data.part, "start" : data.start}, 
                    success, 
                    "json"
                );
            }  else {
                window.onbeforeunload = function(){ return null; }
            }
        } else {
        	tke_alert(data.info,'alert-error');
        }
    }
});
highlight_subnav("{:U('Database/index/type/import')}");
</script>
</block>
